package com.hqq.helloworld;

import com.google.inject.AbstractModule;
import com.hqq.demo.MyApplet;

import java.io.PrintStream;

/**
 * Package: com.hqq.helloworld
 * User: 何芊芊
 * Email: heqianqian1@jd.com
 * Date: 2018/1/21
 * Time: 14:16
 * Description:HelloWorld相关依赖初始化
 */
public class HelloWorldModule extends AbstractModule {
    @Override
    protected void configure() {
        bind(MyApplet.class).to(StringWritingApplet.class);
        bind(Destination.class).to(PrintStreamWriter.class);
        bind(PrintStream.class).toInstance(System.out);
//        bind(String.class).toInstance("Hello World!");
//        bind(String.class).toProvider(() -> "Hello Guice");
        //绑定具有output相关的string
        bind(String.class).annotatedWith(Output.class).toProvider(() -> "Hello Guice");
    }

//    @Provides
//    private String getString() {
//        return "Hello World";
//    }
}
